<?php 
	$link_view = Router::url('/');
	$link_view .= "locums/apply/";
?>


<!--RESULT-->
<div class="result">

<?php foreach ( $data as $Vacancy ) :
			if(!empty($Vacancy['Vacancy']['DateRange']))
			{
				$a_Event = explode(',',$Vacancy['Vacancy']['DateRange']);
	            $a_Temps = array();
	            if($a_Event)
	            {
	                foreach($a_Event as $event)
	                {
	                    $a_Temps[] = strtotime($event);
	                }
	            }
	            sort($a_Temps);
	            $i_currentMonth = date('n');
	           // $a_EventMonth = explode('-',date('m'));
	            $i_eventMonth = date('m',$a_Temps[0]);
	            $jump = $i_eventMonth - $i_currentMonth;
			
			}else
				{
					$jump = 0;
				}
           
?>

<!--RESULT WRAP-->
<div class="result_wrap">

<!--COLUMN 1-->
<div class="FourColGrid_c1">
<div id="myAvatar"><img src="<?php echo Router::url('/')?>app/webroot/img/avatar.jpg" width="100" alt="Pharmacy Shop picture"></div>
<a href="<?php echo $link_view . $Vacancy['Vacancy']['id']; ?>" class="TitleFive">View</a>
</div>
<!--COLUMN 1-->

<!--COLUMN 2-->
<div class="FourColGrid_c2">
<h4 class="TitleTwo"><?php echo $Vacancy['Vacancy']['Title'].' Id'.$Vacancy['Vacancy']['id'];?></h4>
<p><b><?php echo $GLOBALS['Country'][$Vacancy['Vacancy']['County_id']];?></b><br>
<b>Postcode: </b><?php echo $Vacancy['Vacancy']['PostCode'];?><br>
<b>Rate of pay</b> - <?php echo '£'.$Vacancy['Vacancy']['HourlyRate'];?> per hour<br>
<b>Milage allowance after</b> = 0 - <?php echo $Vacancy['Vacancy']['MilageAllowanceAfterMiles'];?> miles<br>
<b>Milage rate</b> - <?php echo $Vacancy['Vacancy']['MilageRateInPence'];?> per mile<br>
<b>Other expenses</b> - <?php echo $Vacancy['Vacancy']['OtherExpenses'];?></p>
</div>
<!--COLUMN 2-->

<!--COLUMN 3-->
<div class="FourColGrid_c3">
<div class="eventCalendarNoCache_<?php echo $Vacancy['Vacancy']['id']?>"></div>
<script>
$(document).ready(function() {
$(".eventCalendarNoCache_"+<?php echo $Vacancy['Vacancy']['id']?>).eventCalendar({
	eventsjson: '<?php echo Router::url('/').'searches/getJsonVacancy/'.$Vacancy['Vacancy']['id'] ?>',
	cacheJson: false,
	multiple: true,
	allowClick:false,
	onlychoose:true,
	jumpMonth:'<?php echo $jump ?>'
});
});
</script>
<ul class="listTwo">
<li class="available"> = Vacancy</li>
<li class="unavailable"> = No Vacancy</li>
</ul>  
</div>
<!--COLUMN 3-->

<br class="clear"/>
</div>
<!--RESULT WRAP-->

<?php endforeach;?>

</div>
<!--RESULT-->

<!--COLUMN 4-->
<div class="FourColGrid_c4">
<h6 class="TitleFive">Vacancy Search</h6>
<?php echo $this->element('search');?>

<p>&nbsp;</p> 
</div>
<!--COLUMN 4-->
<br class="clear"/>

<?php if(count ($data) == 0):?>
<?php else :?>

<!--Paginate-->
<div class="paginate">
<?php $paginator->options = array('url'=>array("?" =>$sz_params))?> 
Showing Page <?php echo $paginator->counter(); ?> &nbsp;&nbsp;&nbsp;
<?php echo $paginator->prev(); ?>&nbsp;
<?php echo $paginator->numbers(); ?>&nbsp;
<?php echo $paginator->next(); ?> 
<?php endif;?>
</div>
<!--Paginate-->